package com.kuang.service;

import com.kuang.dao.BookMapper;
import com.kuang.pojo.Books;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookServiceImpl implements BookService {

  //调用dao层的操作，设置一个set接口，方便Spring管理
  @Autowired
  private BookMapper bookMapper;


  public void setBookMapper(BookMapper bookMapper) {
    this.bookMapper = bookMapper;
  }
  @Override
  public int addBook(Books book) {
    return bookMapper.addBook(book);
  }
  @Override
  public int deleteBookById(int id) {
    return bookMapper.deleteBookById(id);
  }
  @Override
  public int updateBook(Books books) {
    return bookMapper.updateBook(books);
  }
  @Override
  public Books queryBookById(int id) {
    return bookMapper.queryBookById(id);
  }
  @Override
  public List<Books> queryAllBook() {
    return bookMapper.queryAllBook();
  }

  @Override
  public Books queryBookName(String name) {
    return bookMapper.queryBookName(name);
  }
}
